<?php
namespace app\admin\controller;

use app\admin\org\Account;
use app\admin\org\Power;
use think\Controller;

class Login extends Base
{
    public function login(){
        if(request()->isPost()){
            $account = input('param.account','','trim');
            $pwd = input('param.pwd','','trim');
            if($result = Account::check_account($account,$pwd,$out)){
                $O = new Power();
                $O->loginok($out['account'],$out['real_name'],$out['power_id'],$out['power_bicycle_place_id']);
                return json(rm(0,'登录成功',''));
            }else{
                return json(rm(1,$out,''));
            }
        }else{
            return $this->fetch();
        }
    }
}